package com.qf.service;

import com.qf.dao.UserDao;
import com.qf.pojo.User;

public class UserServiceImpl implements UserService{
    UserDao userDao;

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public User login(String username, String password) {
        User user = userDao.selectUsernameAndPassword(username,password);
        // 校验
        if (user == null) {
            throw new RuntimeException("账户或用户名错误");
        }
        return user;
    }

    @Override
    public void register(User user) {
        userDao.insertUser(user);
    }


}
